package com.huang.controller;

import com.huang.common.utils.SecurityAuthenticationUtils;
import com.huang.domain.SysUser;
import com.huang.service.SysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author hqy
 * @date 2022年06月21日 16:19
 */
@RestController
@RequestMapping("/sys/user")
@Api(tags = "用户信息获取接口文档")
public class SysUserController {

    @Autowired
    private SysUserService sysUserService;

    @ApiOperation("获取用户的信息")
    @GetMapping("/info")
    public ResponseEntity<SysUser> getUserInfo(){
        SysUser sysUser = sysUserService.getById(SecurityAuthenticationUtils.getUserId());
        return ResponseEntity.ok(sysUser);
    }
}
